//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.hecai.scanning.util;

import java.io.File;
import java.net.URL;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class FileDirUtil
{
    private static final Logger log = LoggerFactory.getLogger(FileDirUtil.class);
    public static final String USER_DIR = System.getProperty("user.dir");

    public FileDirUtil()
    {
    }

    public static String getResourceFile(String positionFilePath)
    {
        String targetPath = "";
        URL url = FileDirUtil.class.getClassLoader().getResource(positionFilePath);
        if (null != url && !url.getPath().contains(".jar"))
        {
            targetPath = url.getPath();
        } else
        {
            targetPath = USER_DIR + File.separator + positionFilePath;
        }

        return targetPath;
    }

    public static String createBodyMsg(String linkCode, String... bodyMsgs)
    {
        if (null != linkCode && null != bodyMsgs)
        {
            StringBuilder sb = new StringBuilder();
            String[] var3 = bodyMsgs;
            int var4 = bodyMsgs.length;

            for (int var5 = 0; var5 < var4; ++var5)
            {
                String bodyMsg = var3[var5];
                sb.append(bodyMsg).append(linkCode);
            }

            sb.deleteCharAt(sb.length() - 1);
            return sb.toString();
        } else
        {
            return null;
        }
    }

    public static String autoZero(int num, int length)
    {
        String s = num + "";
        if (s.length() == length)
        {
            return s;
        } else if (s.length() >= length)
        {
            return num + "";
        } else
        {
            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < length - s.length(); ++i)
            {
                sb.append("0");
            }

            sb.append(s);
            return sb.toString();
        }
    }

    public static String getTimeNumbers(String timeStr)
    {
        String years = timeStr.split(" ")[0];
        String times = timeStr.split(" ")[1];
        String[] yeas = years.split("/");
        String[] tims = times.split(":");
        StringBuilder sb = new StringBuilder();
        String[] var6 = yeas;
        int var7 = yeas.length;

        int var8;
        String tim;
        String fir;
        String sen;
        for (var8 = 0; var8 < var7; ++var8)
        {
            tim = var6[var8];
            fir = tim.substring(0, 1);
            sen = tim.substring(1);
            sb.append(fir).append(",").append(sen).append(",");
        }

        var6 = tims;
        var7 = tims.length;

        for (var8 = 0; var8 < var7; ++var8)
        {
            tim = var6[var8];
            fir = tim.substring(0, 1);
            sen = tim.substring(1);
            sb.append(fir).append(",").append(sen).append(",");
        }

        sb.deleteCharAt(sb.length() - 1);
        return sb.toString();
    }
}
